package com.cheetah.start.module.monitor.service.impl;

import com.cheetah.start.module.monitor.service.ISysMsgService;
import com.cheetah.start.module.system.domain.MailDo;
import com.cheetah.start.module.system.domain.SysSet;
import com.cheetah.start.module.system.service.ISysSetService;
import com.cheetah.start.module.system.service.impl.MailService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author 25175
 * @date 2022/4/2 13:14
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class SysMsgMailServiceImpl implements ISysMsgService {
    private final ISysSetService setService;
    private final MailService mailService;


    @Override
    public void send(String msg) {
        SysSet sysSet = setService.getByKey("email", false);
        String email = sysSet.getSetValue();
        MailDo mailDo = new MailDo(email, "服务器信息", msg);
        mailService.sendMail(mailDo);
    }



}
